Skip to content

Conversation

DavidWAbrahams
Copy link

@DavidWAbrahams DavidWAbrahams commented May 28, 2020

Allow you to freeze the backbone encoder partially. For example, you can set encoder_freeze=0.8 which will make the first 80% layers untrainable, and leave the last 20% trainable.

This lets you tune the trainability of your network.

I freeze early layers first because: early layers learn basic features that are less likely to change between data sets. Late layers learn abstract features that may change more between data sets.

In my experiment, setting a 95% freeze was good for accuracy AND training speed for Unet + inceptionv3 on the Oxford-IIIT Pet dataset (code at https://github.com/AllWashedOut/pet_segmentation)

0% frozen

python .\model.py --patience=10 --encoder_freeze_percent=0.0
Test accuracy: 90.0%. Epoch time: 60s

95% frozen

python .\model.py --patience=10 --encoder_freeze_percent=0.95
Test accuracy: 91.13%. Epoch time: 52s

100% frozen

python .\model.py --patience=10 --encoder_freeze_percent=1.0
Test accuracy: 90.99%. Epoch time: 50s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant